<html>
<head><meta charset="utf-8"><title>poor error message with const_evaluatable_checked · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html">poor error message with const_evaluatable_checked</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="229311788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229311788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229311788">(Mar 08 2021 at 14:59)</a>:</h4>
<p>Is anyone aware of an existing issue for this? I <em>am</em> giving a type, but the real problem is that <code>: Array</code> is not met, which is relegated to a <code>note</code>.</p>
<div class="codehilite"><pre><span></span><code>error[E0283]: type annotations needed for `ArrayVec&lt;[T; _]&gt;`
  --&gt; src/lib.rs:10:40
   |
10 |     let mut xs: ArrayVec&lt;[T; N + 1]&gt; = ArrayVec::new();
   |         ------                         ^^^^^^^^^^^^^ cannot infer type for array `[T; _]`
   |         |
   |         consider giving `xs` the explicit type `ArrayVec&lt;[T; _]&gt;`, where the type parameter `[T; _]` is specified
   |
   = note: cannot satisfy `[T; _]: Array`
   = note: required by `ArrayVec::&lt;A&gt;::new`
</code></pre></div>



<a name="229323844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229323844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229323844">(Mar 08 2021 at 16:06)</a>:</h4>
<p>it seems _ok_ to me</p>



<a name="229323965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229323965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229323965">(Mar 08 2021 at 16:06)</a>:</h4>
<p>on its face ofc</p>



<a name="229325866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229325866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229325866">(Mar 08 2021 at 16:13)</a>:</h4>
<p>I'm not sure how <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> . The error says "add type annotations". There already <strong>are</strong> type annotations.</p>



<a name="229355062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229355062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229355062">(Mar 08 2021 at 19:00)</a>:</h4>
<p>seems related to const generics, <span class="user-mention" data-user-id="116155">@Jake Goulding</span> I'd repost this in <a class="stream" data-stream-id="260443" href="/#narrow/stream/260443-project-const-generics">#project-const-generics</a> and see if they know of any related issues</p>



<a name="229356153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229356153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229356153">(Mar 08 2021 at 19:07)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="216206">@lcnr</span></p>



<a name="229367181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229367181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229367181">(Mar 08 2021 at 20:19)</a>:</h4>
<p>not sure whether we have an issue for this <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> </p>
<p>if you're able to fairly quickly get an mvce here please open an issue <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="229379473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229379473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229379473">(Mar 08 2021 at 21:44)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> this is the repro I have:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![allow(incomplete_features)]</span><span class="w"></span>
<span class="cp">#![feature(const_generics, const_evaluatable_checked)]</span><span class="w"></span>

<span class="k">use</span><span class="w"> </span><span class="n">arrayvec</span>::<span class="n">ArrayVec</span><span class="p">;</span><span class="w"> </span><span class="c1">// 0.5.2</span>

<span class="k">fn</span> <span class="nf">append</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="p">(</span><span class="n">start</span>: <span class="p">[</span><span class="n">T</span><span class="p">;</span><span class="w"> </span><span class="n">N</span><span class="p">],</span><span class="w"> </span><span class="n">v</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="n">T</span><span class="p">;</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">]</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">xs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ArrayVec</span>::<span class="n">new</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="n">N</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">xs</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">v</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="n">xs</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="n">v</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">xs</span><span class="p">.</span><span class="n">into_inner</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="nb">Ok</span><span class="p">(</span><span class="n">xs</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">xs</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="fm">unreachable!</span><span class="p">()</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Do you want me to continue to try to minify it?</p>



<a name="229448251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229448251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229448251">(Mar 09 2021 at 09:39)</a>:</h4>
<p>hmm <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>
<p>this already works on the playground, so imo it's fine for now</p>



<a name="229448300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229448300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229448300">(Mar 09 2021 at 09:39)</a>:</h4>
<p>there's still a lot of work to do for <code>const_evaluatable_checked</code> and i fear that we might fix this error message on accident while doing so</p>



<a name="229448441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229448441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229448441">(Mar 09 2021 at 09:40)</a>:</h4>
<p>can you open an issue for this? Otherwise i can also do that</p>



<a name="229479825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229479825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229479825">(Mar 09 2021 at 13:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked/near/229448251">said</a>:</p>
<blockquote>
<p>this already works on the playground, so imo it's fine for now</p>
</blockquote>
<p>You think I'd use anything else? <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="229480781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/poor%20error%20message%20with%20const_evaluatable_checked/near/229480781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/poor.20error.20message.20with.20const_evaluatable_checked.html#229480781">(Mar 09 2021 at 14:01)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/82934">https://github.com/rust-lang/rust/issues/82934</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>